// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout, PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'
import CommonLayout from '@/layouts/CommonLayout'
import TitleView from '@/layouts/TitleView'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

// 登录页url
export const LOGIN_PATH = '/user/login'

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    // redirect: '/dashboard/workplace',
    redirect: '/admin',
    children: [
      // 管理员
      {
        path: '/admin',
        name: 'admin',
        component: TitleView,
        redirect: '/list/user',
        meta: { title: '管理员操作', icon: 'check-circle-o', permission: ['admin'] },
        children: [
          {
            path: '/list/user',
            name: 'UserList',
            component: RouteView,
            // component: () => import('@/views/newp/UserList'),
            redirect: '/list/user-list',
            meta: { title:'账号管理', permission: ['admin'] },
            hideChildrenInMenu:true,
            children:[
              {
                path: '/list/user-list/tab',
                hidden:true,
                name: 'tab',
                component: () => import('@/layouts/tab'),
                meta: { title:'tab', permission: ['admin'] }
              },{
                path: '/list/user-list',
                name: 'UserList',
                hidden:true,
                // component: RouteView,
                 component: () => import('@/views/newp/UserList'),
                meta: { title:'账号管理', permission: ['admin'] },
              }
            ]
          },
          {
            path: '/list/tab',
            hidden:true,
            name: 'tab',
            component: () => import('@/layouts/tab'),
            meta: { title:'Tab2', permission: ['admin'] }
          },
          {
            path: '/list/device-list',
            name: 'Devicelist',
            component: () => import('@/views/demo/DeviceList'),
            meta: { title: '装置管理', permission: ['admin'] }
          },
          {
            path: '/list/syc-config',
            name: 'SycConfig',
            component: () => import('@/views/newp/SycConfig'),
            meta: { title: '系统设置', permission: ['admin'] }
          }
        ]
      },
      // 操作员
      {
        path: '/admin',
        name: 'admin',
        component: RouteView,
        redirect: '/list/user-list',
        meta: { title: '安全策略', icon: 'check-circle-o', permission: ['operator'] },
        children: [
          {
            path: '/list/user-list',
            name: 'UserList',
            component: () => import('@/views/newp/UserList'),
            meta: { title: '黑名单', permission: ['operator'] }
          },
          {
            path: '/list/device-list',
            name: 'Devicelist',
            component: () => import('@/views/demo/DeviceList'),
            meta: { title: '白名单', permission: ['operator'] }
          },
          {
            path: '/list/syc-config',
            name: 'SycConfig',
            component: () => import('@/views/newp/SycConfig'),
            meta: { title: 'IP/MAC', permission: ['operator'] }
          }
        ]
      },
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]
export const asyncHeaderRouteMap = {
  header1: [
    {
      path: '/',
      name: 'index',
      component: BasicLayout,
      meta: { title: 'menu.home' },
      // redirect: '/dashboard/workplace',
      redirect: '/admin',
      children: [
        // 管理员
        {
          path: '/admin',
          name: 'admin',
          component: TitleView,
          redirect: '/list/user',
          meta: { title: '管理员操作1', icon: 'check-circle-o', permission: ['admin'] },
          children: [
            {
              path: '/list/user',
              name: 'UserList',
              component: RouteView,
              // component: () => import('@/views/newp/UserList'),
              redirect: '/list/user-list',
              meta: { title:'账号管理', permission: ['admin'] },
              hideChildrenInMenu:true,
              children:[
                {
                  path: '/list/user-list/tab',
                  hidden:true,
                  name: 'tab',
                  component: () => import('@/layouts/tab'),
                  meta: { title:'tab', permission: ['admin'] }
                },{
                  path: '/list/user-list',
                  name: 'UserList',
                  hidden:true,
                  // component: RouteView,
                  component: () => import('@/views/newp/UserList'),
                  meta: { title:'账号管理', permission: ['admin'] },
                }
              ]
            },
            {
              path: '/list/tab',
              hidden:true,
              name: 'tab',
              component: () => import('@/layouts/tab'),
              meta: { title:'Tab2', permission: ['admin'] }
            },
            {
              path: '/list/device-list',
              name: 'Devicelist',
              component: () => import('@/views/demo/DeviceList'),
              meta: { title: '装置管理1', permission: ['admin'] }
            },
            {
              path: '/list/syc-config',
              name: 'SycConfig',
              component: () => import('@/views/newp/SycConfig'),
              meta: { title: '系统设置1', permission: ['admin'] }
            }
          ]
        },
        // 操作员
        {
          path: '/admin',
          name: 'admin',
          component: RouteView,
          redirect: '/list/user-list',
          meta: { title: '安全策略', icon: 'check-circle-o', permission: ['operator'] },
          children: [
            {
              path: '/list/user-list',
              name: 'UserList',
              component: () => import('@/views/newp/UserList'),
              meta: { title: '黑名单', permission: ['operator'] }
            },
            {
              path: '/list/device-list',
              name: 'Devicelist',
              component: () => import('@/views/demo/DeviceList'),
              meta: { title: '白名单', permission: ['operator'] }
            },
            {
              path: '/list/syc-config',
              name: 'SycConfig',
              component: () => import('@/views/newp/SycConfig'),
              meta: { title: 'IP/MAC', permission: ['operator'] }
            }
          ]
        },
      ]
    },
    {
      path: '*',
      redirect: '/404',
      hidden: true
    }
  ]
}

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: CommonLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
